package main

type TreeNode struct {
	Val   int
	Left  *TreeNode
	Right *TreeNode
}

/**
 *
 * @param root TreeNode类
 * @return bool布尔型
 */
func isSymmetric(root *TreeNode) bool {
	// write code here
	if root == nil {
		return true
	}
	return symmetric(root.Left, root.Right)
}
func symmetric(a, b *TreeNode) bool {
	if a == nil && b == nil {
		return true
	}
	if a != nil && b != nil {
		return a.Val == b.Val && symmetric(a.Left, b.Right) && symmetric(a.Right, b.Left)
	}
	return false
}
